package com.example.rule.controller;


import com.example.rule.common.result.Result;
import com.example.rule.common.web.Results;
import com.example.rule.entity.dto.ConditionSaveDTO;
import com.example.rule.service.ConditionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Tag(name = "条件管理")
@RequiredArgsConstructor
@RequestMapping("/condition")
public class ConditionController {

    private final ConditionService conditionService;


    @PostMapping("/save")
    @Operation(summary = "新增条件", description = "根据传入参数保存一个新的条件")
    @ApiResponse(responseCode = "200", description = "操作成功", content = @Content(mediaType = "application/json"))
    public Result<Void> save(@RequestBody @Schema(description = "条件保存请求参数") ConditionSaveDTO params) {
        conditionService.save(params);
        return Results.success();
    }




}
